package com.union.core.information.service;

import java.util.List;

import org.apache.log4j.Logger;

import com.union.core.information.dao.AnnouncementDao;
import com.union.core.information.dao.impl.AnnouncementDaoImpl;
import com.union.core.information.model.Announcement;

public class AnnouncementService{
	
	private AnnouncementDao announcementDaoImpl;
	private static Logger log = Logger.getLogger(AnnouncementService.class.getName());
	
	public AnnouncementService(){
		announcementDaoImpl = new AnnouncementDaoImpl();
	}
	
	public List<Announcement> queryList(int announcement_id,String announcement_name,String announcement_content,String join_date1,
			String join_date2,String add_user,String add_time,int org_id,String paramName, String paramValue, String orderByName,int start,int pageSize){
		List<Announcement> announcementList = announcementDaoImpl.queryList(announcement_id, announcement_name, 
				announcement_content, join_date1, join_date2, add_user, add_time, org_id,paramName, paramValue, orderByName, start, pageSize);
		log.info("PLAT 查询公告信息：announcement_id="+announcement_id+",announcement_name="+announcement_name+",announcement_content="+announcement_content
				+ ",join_date1="+join_date1+",join_date2="+join_date2+",add_user="+add_user+",add_time="+add_time
				+ ",paramName="+paramName+",paramValue="+paramValue+",orderByName="+orderByName
				+ ",start="+start+",pageSize="+pageSize);
		return announcementList;
	}
	

	public int quertListCount(int announcement_id,String announcement_name,String announcement_content,String join_date1,
			String join_date2,String add_user,String add_time,int org_id,String paramName, String paramValue){
		int count = announcementDaoImpl.quertListCount(announcement_id, announcement_name, announcement_content, 
				join_date1, join_date2, add_user, add_time, org_id,paramName, paramValue);
		log.info("PLAT 查询多条公告信息：count="+count+",announcement_id="+announcement_id+",announcement_name="+announcement_name+",announcement_content="+announcement_content
				+ ",join_date1="+join_date1+",join_date2="+join_date2+",add_user="+add_user+",add_time="+add_time
				+ ",paramName="+paramName+",paramValue="+paramValue);
		return count;
	}
	
	/**
	 * 
	 * @param announcement_id
	 * @return
	 */
	public Announcement query(int announcement_id){
		Announcement announcement = announcementDaoImpl.query(announcement_id);
    	log.info("PLAT: 查询公告信息: "+announcement.getAnnouncement_id());
    	return announcement;
	}
	
	public Announcement queryNew(int org_id){
		Announcement announcement = announcementDaoImpl.queryNew(org_id);
    	log.info("PLAT: 查询公告信息: "+org_id);
    	return announcement;
	}
	/**
	 * 
	 * @param announcement
	 * @return
	 */
	public void add(Announcement announcement){
		announcementDaoImpl.add(announcement);
		log.info("PLAT: 添加查询公告信息: "+announcement.getAnnouncement_name());
	}
	
	/**
	 * 
	 * @param announcement
	 * @return
	 */
	public boolean edit(Announcement announcement){
		boolean bl=false;
		bl=announcementDaoImpl.edit(announcement);
		log.info("PLAT: 修改查询公告信息: "+announcement.getAnnouncement_id());
		return bl;
	}
	
	/**
	 * 
	 * @param announcement_id
	 * @return
	 */
	public void delete(int announcement_id){
		announcementDaoImpl.delete(announcement_id);
		log.info("PLAT: 修改查询公告信息: announcement_id="+announcement_id);
	}
}